﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using suirui.ZhuMu.Common;
using suirui.ZhuMu.Log;
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;

namespace suirui.ZhuMu.WebCore
{
    /// <summary>
    /// 自定义ServiceFileter
    /// </summary>
    public class CustomIOCFilterFactoryAttribute:Attribute,IFilterFactory
    {
        private Type _FilterType = null;
        public CustomIOCFilterFactoryAttribute(Type type)
        {
            _FilterType = type;
        }

        public bool IsReusable => true;
        public IFilterMetadata CreateInstance(IServiceProvider serviceProvider)
        {
            return (IFilterMetadata)serviceProvider.GetService(_FilterType);
        }
    }
}
